Switch from rusha to native (node:crypto) sha1 implementation #329
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
Useless rusha usage
Changes
I switch from rusha to native (node:crypto) sha1 implementation
Benchmarks
Node.js
$ node benchmarks/rusha-vs-native.mjs clk: ~3.99 GHz cpu: AMD Ryzen 7 7700 8-Core Processor runtime: node 22.11.0 (x64-linux) benchmark avg (min … max) p75 p99 (min … top 1%) ------------------------------------------- ------------------------------- _hash with rusha 12.10 µs/iter 7.25 µs █ (4.66 µs … 1.27 ms) 116.62 µs █▄▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ _hash with native 547.04 ns/iter 435.45 ns █ (370.08 ns … 3.61 µs) 3.58 µs █▃▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ summary _hash with native 22.12x faster than _hash with rusha
Bun
bun benchmarks/rusha-vs-native.mjs clk: ~5.04 GHz cpu: AMD Ryzen 7 7700 8-Core Processor runtime: bun 1.1.37 (x64-linux) benchmark avg (min … max) p75 p99 (min … top 1%) ------------------------------------------- ------------------------------- _hash with rusha 10.00 µs/iter 4.96 µs █ (2.60 µs … 2.78 ms) 45.85 µs ▂█▂▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ _hash with native 471.82 ns/iter 420.00 ns █ (370.00 ns … 949.79 µs) 1.99 µs █▆▂▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ summary _hash with native 21.19x faster than _hash with rusha
Release info Sub-libraries affected
Bump level
Libraries affected
Changelog notes